
const allServices = require('../config/mysqlconfig')


// 用户登录
const userLogin = (username,userpwd)=>{
    // let _sql = `select * from users where username="${username}" and userpwd="${userpwd}";`
    let _sql = `select * from users where username="${username}" ;`
    return allServices.query(_sql)
}

// 用户注册
const userRegister = (_username,_userpwd)=>{
// INSERT INTO users (username,userpwd,credit,balance,avatar,nickname) VALUES('123456','123456',255,255.0,'11','册数')
    let _sql = `insert into users (username,userpwd,credit,balance,avatar,nickname) values ('${_username}','${_userpwd}',255,0,'11','还没有起名字哦')`
    return allServices.query(_sql)
}

// 获取用户信息
const getUserInfo = (userId)=>{
    let _sql = `select * from users where user_id = "${userId}"`
    return allServices.query(_sql)
}
module.exports = {
    userLogin,
    userRegister,
    getUserInfo
}